package com.xxpt.common.config;

import com.xxpt.common.auth.AuthHandlerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * 拦截器配置
 * @Author masl - 2020/4/8 10:46
 */
@Configuration
public class WebMvcConfigurer extends WebMvcConfigurationSupport {
    @Bean
    AuthHandlerInterceptor getSecurityInterceptor() {
        return new AuthHandlerInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getSecurityInterceptor());
    }

    /**
     * 添加自定义的Converters和Formatters.
     */
    /*@Override
    protected void addFormatters(FormatterRegistry registry) {
        registry.addConverter(new StringToDateConverter());
    }*/
}
